package com.springapp.controller;

import com.springapp.service.impl.ArticlePickingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by nicol_000 on 03/09/14.
 */
@Controller
public class ControlAlertePicking {

    @Autowired
    private ArticlePickingService artServicePicking;


    @RequestMapping(value="/ReapproPicking", method = RequestMethod.GET)
    public ModelAndView displayDashboard(){
        ModelAndView model = new ModelAndView("Serv_Reap_Picking");

        model.addObject("lstArticlePicking", artServicePicking.getLstArticlePickingAlertes(true));

        return model;
    }

    @RequestMapping(value="/CalculStockPicking", method = RequestMethod.POST)
    public ModelAndView CalculStocks(){
        ModelAndView model = new ModelAndView("Serv_Reap_Picking");

        model.addObject("sUpdateOK", artServicePicking.updateStocksPicking());
        //On récupère la liste des articles et on l'envoie à la JSP.

        model.addObject("lstArticlePicking", artServicePicking.getLstArticlePickingAlertes(true));
        return model;
    }

}
